package com.ccb.sc.common.modules.setting.vo;

import com.ccb.sc.common.bind.annotation.Mapping;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author ken
 * @version 1.0
 * @date 2020-09-23
 */
@ApiModel("店主购买奖励比例设置")
public class ShopkeeperAwardSettingsVo implements Serializable {

    @ApiModelProperty("优秀店主自己购买奖励比例，[0,100]")
    @NotNull
    @Mapping(value = "shopkeeper.level1.award")
    private BigDecimal level1Award;

    @ApiModelProperty("优秀店主直接下级购买奖励比例，[0,100]")
    @NotNull
    @Mapping(value = "shopkeeper.level1.award.directSuperior")
    private BigDecimal level1DirectSuperiorAward;

    @ApiModelProperty("优秀店主间接下级购买奖励比例，[0,100]")
    @NotNull
    @Mapping(value = "shopkeeper.level1.award.indirectSuperior")
    private BigDecimal level1IndirectSuperiorAward;

    @ApiModelProperty("卓越店主自己购买奖励比例，[0,100]")
    @NotNull
    @Mapping(value = "shopkeeper.level2.award")
    private BigDecimal level2Award;

    @ApiModelProperty("卓越店主直接下级购买奖励比例，[0,100]")
    @NotNull
    @Mapping(value = "shopkeeper.level2.award.directSuperior")
    private BigDecimal level2DirectSuperiorAward;

    @ApiModelProperty("卓越店主间接下级购买奖励比例，[0,100]")
    @NotNull
    @Mapping(value = "shopkeeper.level2.award.indirectSuperior")
    private BigDecimal level2IndirectSuperiorAward;

    @ApiModelProperty("合伙人自己购买奖励比例，[0,100]")
    @NotNull
    @Mapping(value = "shopkeeper.level3.award")
    private BigDecimal level3Award;

    @ApiModelProperty("合伙人直接下级购买奖励比例，[0,100]")
    @NotNull
    @Mapping(value = "shopkeeper.level3.award.directSuperior")
    private BigDecimal level3DirectSuperiorAward;

    @ApiModelProperty("合伙人间接下级购买奖励比例，[0,100]")
    @NotNull
    @Mapping(value = "shopkeeper.level3.award.indirectSuperior")
    private BigDecimal level3IndirectSuperiorAward;

    public BigDecimal getLevel1Award() {
        return level1Award;
    }

    public void setLevel1Award(BigDecimal level1Award) {
        this.level1Award = level1Award;
    }

    public BigDecimal getLevel1DirectSuperiorAward() {
        return level1DirectSuperiorAward;
    }

    public void setLevel1DirectSuperiorAward(BigDecimal level1DirectSuperiorAward) {
        this.level1DirectSuperiorAward = level1DirectSuperiorAward;
    }

    public BigDecimal getLevel1IndirectSuperiorAward() {
        return level1IndirectSuperiorAward;
    }

    public void setLevel1IndirectSuperiorAward(BigDecimal level1IndirectSuperiorAward) {
        this.level1IndirectSuperiorAward = level1IndirectSuperiorAward;
    }

    public BigDecimal getLevel2Award() {
        return level2Award;
    }

    public void setLevel2Award(BigDecimal level2Award) {
        this.level2Award = level2Award;
    }

    public BigDecimal getLevel2DirectSuperiorAward() {
        return level2DirectSuperiorAward;
    }

    public void setLevel2DirectSuperiorAward(BigDecimal level2DirectSuperiorAward) {
        this.level2DirectSuperiorAward = level2DirectSuperiorAward;
    }

    public BigDecimal getLevel2IndirectSuperiorAward() {
        return level2IndirectSuperiorAward;
    }

    public void setLevel2IndirectSuperiorAward(BigDecimal level2IndirectSuperiorAward) {
        this.level2IndirectSuperiorAward = level2IndirectSuperiorAward;
    }

    public BigDecimal getLevel3Award() {
        return level3Award;
    }

    public void setLevel3Award(BigDecimal level3Award) {
        this.level3Award = level3Award;
    }

    public BigDecimal getLevel3DirectSuperiorAward() {
        return level3DirectSuperiorAward;
    }

    public void setLevel3DirectSuperiorAward(BigDecimal level3DirectSuperiorAward) {
        this.level3DirectSuperiorAward = level3DirectSuperiorAward;
    }

    public BigDecimal getLevel3IndirectSuperiorAward() {
        return level3IndirectSuperiorAward;
    }

    public void setLevel3IndirectSuperiorAward(BigDecimal level3IndirectSuperiorAward) {
        this.level3IndirectSuperiorAward = level3IndirectSuperiorAward;
    }

    private BigDecimal getMaxAward() {
        return level3DirectSuperiorAward;
    }

    public BigDecimal getLevelAward(int level) {
        if (level == 1) {
            return level1Award;
        }
        if (level == 2) {
            return level2Award;
        }
        if (level == 3) {
            return level3Award;
        }
        return BigDecimal.ZERO;
    }
}
